devfandomcom-20200223-history
User talk:DarthKitty
Welcome Hi, welcome to ! Thanks for your edit to the Lua templating/Reference manual/Scribunto libraries page. Please leave a message on my talk page if I can help with anything! Cqm (talk) 20:14, March 1, 2015 (UTC) Lua modules Why are you adding a category to every module ns page? If it's so you want a list of them there's or - there's no need for a category as well. First, I think that categories are more discoverable than AllPages or PrefixIndex, which matters now since every module on dev.wikia.com is effectively global. Second, the number of modules on this wiki is only going to increase, making organization more important; putting them all in a category is a good first step. Finally, I don't see any harm in adding categories—maybe you can explain the problem to me? DarthKitty (talk) 14:30, June 30, 2015 (UTC) :Because categorising every page in a namespace is ridiculous. It's not like you categorise every mainspace page with Category:Content. If you want organisation, I'd support categories such as global modules, module tests, etc. I don't understand what you mean by "discoverable" - do you mean more people know about categories than special pages? Yeah, but now I see how dumb that thought process was; I mean, people here probably use AllPages and PrefixIndex on a daily basis! I guess I'm just used to sticking similar pages in a category, but that was obviously a bad idea in this case. Sorry. DarthKitty (talk) 12:19, July 1, 2015 (UTC) Your sandbox Hey DarthKitty, I recently your sandbox module to remove redlinks from your sandbox. Is that okay? Cheers! -- Cube-shaped 07:27, February 9, 2017 (UTC) : Yeah, thanks. :) : Those redlinks were supposed to be useful reminders ("hey, go write some tests/docs"), but that doesn't matter if the module is only #invoked once! I did add some comments with the original code, though, in case I want to reuse the design. : DarthKitty (talk) 08:08, February 9, 2017 (UTC) :: Yeah, I suppose it's alright if those redlinks are reminders (hence why I'm going to leave redlinks on Global Lua Modules alone) but since it was in your sandbox and those were example modules, I removed them as users don't really need to create them. -- Cube-shaped 08:18, February 9, 2017 (UTC) PageFormatter template regexes Hey, I saw you having some trouble with templates and wondered if parseTemplate from here might be of use to you. I honestly can't remember it's limitations, so it may not handle nesting, nor do I thimk it handles multiple uses of the same template, but it might be a starting point if you're having trouble with a pure regex implementation. : That's really interesting, thanks. It didn't occur to me to ask users for the name of a template—that might be a useful addition, instead of just returning the n''th one. : Based on some quick testing, it looks like parseTemplate() ''does handle nesting, but only returns an object for the first match (or false if none is found). However, it also runs into the same problems that ultimately made me give up: : PageFormatter acts kinda like a linter for templates, with automatic fixing capabilities (and almost no configuration :p). It needs to understand what a link is, because otherwise it'll convert them into parameters and mess pages up. It also shouldn't mess with preformatted, 'd stuff—that funky spacing is deliberate, dagnabbit! : The former is doable, but it'll make parsing templates harder because you can't just split by | anymore. The latter is, from what I understand, mathematically impossible to do with regular expressions. : So at this point, we've defined wikitext as a superset of XML, which means we'd need to write a custom parser, which means figuring out how abstract syntax trees are made, and probably much more! I don't feel like diving down that particular rabbit hole (yet?!). : Compounding the issue is the fact that, iirc, the MediaWiki folks have specifically decided against writing a specification for wikitext, I guess to let extension authors do whatever they want? That means that, hypothetically, Wikipedia's wikitext could be completely different from Fandom's. Any parser we might write would be really fragile. :/ : It would be nice if there were an API for this—I mean, I'm using a wikitext parser right now! I couldn't find anything that does what I want, though, and a very quick glance at Parser.php suggests that there's no intermediate step to expose in the first place. OTOH, Scribunto can access any parameters passed to a given template, so maybe nobody thought a JavaScript API would be useful? : I dunno, maybe I'm overthinking this? : DarthKitty (talk) 23:32, April 28, 2017 (UTC) :: Hi, sorry for invading but uhhh.... I kinda figured out a loop around that nested template thing. We use a condition that determines whether the next which will store the next template in an array and continue the process as it replaces the nested template with a unique code name. Sorry for being dumb and twisted, I gotta make it work out by scratch first. ;~; --Ditto Creeper Bot (talk) 13:08, April 29, 2017 (UTC) JS Formatter Could you throw me the link of what you use for formatting JS? Opera's and Dirtymarkup.com don't do that well. O_O --Ditto Creeper Bot (talk) 11:09, May 7, 2017 (UTC) : I mostly do it by hand, haha. I know that's not very efficient, but the good tools are so granular these days that they take hours to set up. I figure, since I'm only working on small stuff, intuition is probably enough for now. ¯\_(ツ)_/¯ : I guess my main guideline is something like "tall is better than wide". I like lines to be as long as necessary, but as short as possible: preferably no more than 80 characters. I also try to group relevant things together, separating these "chunks" with an empty line, e.g. variable declarations → empty line → if statement. A related rule I try to follow is "flat is better than nested": : All of this boils down to one thing: horizontal scrolling is hard, so we should avoid it whenever possible, but vertical scrolling is easy, so we shouldn't be afraid of it. : I helped write our Lua style guide too, so you might wanna check that out if you're still curious. :) : DarthKitty (talk) 12:14, May 7, 2017 (UTC) :: * Walks into talkpage hoping replied. ::: HOLY FLIP?!?! --Ditto Creeper Bot (talk) 17:44, May 7, 2017 (UTC) Colors Hey just to warn you I'm restructuring the Colors module like so. That'll allow the new Color:bright method to include relative luminance and might fix/worsen your issue. (Only problem is that I'm chasing an "ambiguous syntax" error atm.) • speedy • ��︎ • • 16:47, July 3, 2018 (UTC) : That's really interesting, thanks! It doesn't look like that solved the particular bug I've been encountering, though. Basically, something inside of the Color:bright method mutates named colors, because p.parse("white"):bright() returns true the first time it's executed, and false every time afterwords. (The RGB tuples are also different, but I had to modify the function to check that.) The solution is to call mw.clone() every time you grab a named color, which thankfully only happens in the colors.parse method. DarthKitty (talk) 17:40, July 3, 2018 (UTC) :: Oh wow thanks. Feel free to add your fix now • speedy • ��︎ • • 17:46, July 3, 2018 (UTC) Hello DarthKitty, thank you for cleaning up some of my template code over on the Gran Turismo Wiki. I am still having an issue with the infobox not displaying correctly, you can check out Fandyllic's wall where him and I have been attempting to correct this. The images I attached over there show the current result and what I want the final product to look like. Can you assist? Thank you, RickGT (talk) 13:17, July 28, 2018 (UTC) Argument whitespace in T Hey, DarthKitty. Thanks for writing Module:T :) gonna be really useful for . Is it okay if I add a line feed conditional (probably args.lf) that turns it into: • speedy • ��︎ • • 16:28, September 11, 2018 (UTC) (Btw, I notice PageFormatter template regexes - see Module:Testharness U8T:test_invocation for some nice template argument parsing. Needs translating to JS tho.) 16:33, September 11, 2018 (UTC) : Sure, that sounds reasonable. multiline would probably be a better name for the flag, though, maybe with m as a short-cut. : On a related note, , so your example above should look a little nicer: : (Thanks for the tip! I've been looking into using the XML parse tree returned by several APIs for wikitext parsing, but obviously that technique isn't viable from Scribunto. I've been recording my research at User:DarthKitty/Parse templates, so feel free to check it out if you're curious. Some stuff is a little outdated, though! :p) : DarthKitty (talk) 21:32, September 11, 2018 (UTC) :: Interesting, that made for a nice read. The named parameter support is very neat :) just support (nicely named), and the first template looks good! :: • speedy • ��︎ • • 22:45, September 11, 2018 (UTC) Hey, As you've most recently edited the modules of this type}} Other modules of this type template, what would you think about its deletion? Listing two random modules doesn't sound too useful to me, and if users wanted to find these modules themselves they could search through the Global Lua Modules page, IMO. Cheers! -- Cube-shaped 06:05, October 11, 2018 (UTC) : Sure, go ahead. It's pretty inconsistent with the other infoboxes, and like you said, the extra complexity probably isn't worthwhile. DarthKitty (talk) 06:32, October 11, 2018 (UTC) :: Alright, I cleaned it up from the wiki now. -- Cube-shaped 06:51, October 11, 2018 (UTC) Site styling for Module:T Hello, thanks for all your work improving my local Lua contributions. Could you add a override for all: unset; in Module:T? It'll come in handy for documentation (though I have no clue what to name the arg :p) • speedy • ��︎ • • 12:40, November 14, 2018 (UTC) : Do you mean something like this? : That would work, but like you said, I have no clue what to use in place of SOME-FLAG. Maybe plain and p? That'd be correct from a technical standpoint, buuuut: :* I think it's strange that the "plain" version would be fancier than the "fancy" one! :p :* I would expect plain to remove all styles, not just ones on the wrapper. : In the long run, I think it would be better to have styling parameters, so that users could do more than just restore the local appearance of tags. We could add one for the wrapper, one for parameter names, and one for parameter values. There's just one problem: it's impossible to override all: unset;, so we would still need some way to replace it! I can think of a few solutions: : I'm leaning towards option 2, but what do you think? DarthKitty (talk) 17:23, November 14, 2018 (UTC) Auto Doc Is there any way you could add auto documentation for Global Lua Modules/T? That is, could you add support for something like which would create a documentation page listing all of Module:T's features? Are you looking about Global Lua Modules/Codedoc?--＊Lac＊(♪) 23:15, November 19, 2018 (UTC) : I tried using Codedoc to implement auto-documentation, but I was not happy with the results. Here are my problems with it, in order of severity: :* It automatically lists any function with documentation, even if that function is private. The "solution", if you can call it that, is to not document internal functions! No thanks! :* Although there's syntax to mark parameters as optional, they're displayed to readers in exactly the same way as required ones. Worse, there's no way to describe type unions (e.g. this parameter accepts a string or a number). :* The documentation syntax itself seems pretty "magical" to me. What do --%, --@, and --: mean? I don't think I'll remember that information in a few days, and I don't want to have to keep checking the manual. Conversely, @param and @returns are extremely clear. :* The HTML that Codedoc produces is... pretty ugly, to be honest. It's a little distracting IMO. : All in all, Codedoc left a pretty sour taste in my mouth, and I'd rather not use it. I'm not opposed to automatic docs, but I don't think we have anything else to do that? What sort of information were you after, Patrik? DarthKitty (talk) 04:13, November 20, 2018 (UTC) ::Well basically Module:T adds a lot of new features to Template:T, but there's no documentation for them yet aside from the Global Lua Module page. In addition, it seems like you and Speedy are planning more features. So it would be helpful if Module:T added its own documentation, which would be future-proofed and extensive. I believe that NavboxBuilder does something like this without using Codedoc. Edits to PortableNavbox Hey, PortableNavbox is already in use on two wikis, I just moved it to Dev because I thought it would be useful for any other wikis and intended to document it later. Your debug edits are breaking it across about hundred wiki pages. If you're going to continue with testing, please do so under a sandbox module. Thank you! -- Cube-shaped 00:51, December 15, 2018 (UTC) : Ah, sorry about that! I checked if PortableNavbox was being used, but , so I figured it was safe. Maybe next time you could write a Global Lua Modules/$1 page, to indicate that the module is being used elsewhere? I've reverted my edits, sorry again for the trouble! DarthKitty (talk) 00:56, December 15, 2018 (UTC) :: My internet connection is terrible at the moment so I only managed to load your diff with separating the methods after leaving the message, and got into an edit conflict on your talkpage after realizing that. I suppose creating a separate method inside of the module works if you wanted to continue debugging it that way. As I said, I intended to document it later. Also, if you need usage examples, they can be found here and here. -- Cube-shaped 01:06, December 15, 2018 (UTC) Module:Inspect for Testharness? I was wondering whether Kikito's library would be a good fit for Testharness. It reveals details about metatables and inheritance, good stuff :) Do you think binning the string representation in Testharness is a good idea? The main issue is that it doesn't list Lua "arrays" with nil values as if they were arrays. I asked about it so hopefully, the dev comes through with the feature. Inspect does output the ENTIRE metatable EVERY time, but we could start using class modules to help us identify metatables and replace them with small custom identifiers. (Tbh using class modules around the wiki for exported classes would also be much better from a SoC perspective). • speedy • ��︎ • • 17:19, December 20, 2018 (UTC) : I was wondering about that too! If I understand correctly, we could replace the following functions with Inspect: :* u8t_utils.escape_str :* u8t_utils.val_to_str :* u8t_utils.tbl_key_to_str :* u8t_utils.tbl_to_str : I went ahead and did that in the sandbox, but I haven't had time to check how that looks yet. : I'm not sure what you mean by "class modules", since Lua is a prototype-oriented language rather than a class-oriented one. It's possible to create fake classes, as in the following example, but I fail to see how enforcing that design would improve the separation of concerns. local Point = (function () local metatable = {} metatable.__index = {} function metatable.__tostring(self) return string.format("(%i, %i)", self.x, self.y) end function metatable.__index:move(x, y) self.x = self.x + x self.y = self.y + y return self end return function (x, y) local self = {} self.x = x self.y = y return setmetatable(self, metatable) end end)() : DarthKitty (talk) 19:42, December 20, 2018 (UTC) :: Inspect looks okay. It's better than old Testharness methods in some cases, but very spammy when it serialises instances of a prototypal Lua table. (Try mw.html elements or a Color from Dev:Colors - it will list out EVERY single method of the class and newline them all, and it won't be obvious what it is!) :: Yes Lua has fake classes only. I was imagining a format like ProcLua or the Color table in Module:Colors, with a new method for construction (PIL). In the PIL example, account.lua file would be used to return Account - such is a "class module" in LDoc. :: Testharness is one example of a module that lumps different "classes" together, an issue where I've been a repeat offender :p Hence the thought on SoC and modularising this all. :: • speedy • ��︎ • • 20:26, December 20, 2018 (UTC) Module:Quote and other queries Hey DarthKitty! Just had a couple queries about things I could use your help for... #For Module:Quote, which I've just rewritten with permission of the original author, I am also trying to include functionality for a dialogue template (i.e. multiple characters having a discussion, instead of a quote from when character). I've made a prototype for it here, but on this sandbox, the actual quote part is not working. Don't suppose you have any idea why? (the code was merged in from this one, again with permission of the author). #Related to above-- does the HTML structure used there look right to you? #Regarding another module, you remember the Sideicon module on FF wiki? On other wikis, I've created a similar version called Module:Appearances, see this as an example. I was considering bringing it to Dev Wiki, but I'm not sure a) if it would be a good fit, or b) if it's possible to import things from Dev and then pull in a dependency from the local wiki to get the data from. Any thoughts? Thanks!--'Technobliterator' (T' ') 07:26, May 31, 2019 (UTC) Hello. @DarthKitty I am here to ask about the configuration for LockForum JavaScript. So, here is there any way to disable the "expiryDays" but keep the "warningMessage" feature. If not, do you know if there are other scripts like your? Can post your reply here too because it would help:Wiki Extension for displaying an "inactivity" message without actually closing such old threads? Elizhaa (talk) 19:44, July 4, 2019 (UTC)